// 游戏牌局管理者
import GameDB from "./GameDB";
import GameEvent from "./GameEvent";
import GameView from "./GameView/GameView";

export default class GameCtr {
    private m_GameDB:GameDB = null
    private m_GameView:GameView = null

    public Init(gameView:GameView) {
        this.m_GameView = gameView
        cc.systemEvent.on(GameEvent.INIT_POKER,this.m_GameView.OnEventInit,this.m_GameView)
        cc.systemEvent.on(GameEvent.PLAY,this.m_GameView.OnEventPlay,this.m_GameView)
        cc.systemEvent.on(GameEvent.INIT_GROUP_CARD,this.m_GameView.OnEventInitGroupCard,this.m_GameView)
        this.m_GameDB = GameDB.Create()
    }

    public Play() {
        this.m_GameDB.Play()
    }

    public Exit(){
        cc.systemEvent.off(GameEvent.INIT_POKER,this.m_GameView.OnEventInit,this.m_GameView)
    }
}